package com.atguigu.gmall.product.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.common.result.ResultCodeEnum;
import com.atguigu.gmall.product.model.Item;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("admin")
@RefreshScope
public class ItemController {


    //@Value("${gamll.test}")
    //private String val;

    @PostMapping("item")
    public Result<Item> saveItem(Item item) {
        //log.info("读取到val值:{}", val);
        // 模拟业务执行出现异常
        //int i = 1 / 0;
        // 保存业务
        System.out.println("保存成功");
        return Result.build(item, ResultCodeEnum.SUCCESS);
    }
}
